﻿@model PessMvc.Models.ExportArchiveListModel

@{
    ViewBag.Title = "ExportArchiveList";
}
<link href="@Url.Content("~/content/activitie_detail.css")" rel="stylesheet" type="text/css"/>
<link href="@Url.Content("~/content/table_btn.css")" rel="stylesheet" type="text/css"/>

<!--[if lt IE 8]>
    <link href="@Url.Content("~/content/activitie_create.css")" rel="stylesheet" type="text/css"/>
<![endif]-->

<noscript>
    <link href="@Url.Content("~/content/activitie_create.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/content/activitie_noscript.css")" rel="stylesheet" type="text/css"/>
</noscript>

<h2>导出档案列表</h2>
<div id="operate">
    @Html.ActionLink("Back", "Index", "Archive", new {activityID=(int)ViewBag.ActivityID },null)
</div>

<fieldset class="exportFile">    
@using(Html.BeginForm("ExportArchiveList","Archive",FormMethod.Post)){
    @Html.Hidden("ActivityID",(int)ViewBag.ActivityID)

    <div>学科：@Html.DropDownList("SubjectID",(SelectList)ViewBag.SubjectID)    <input type="submit" value="预览" onclick="fly_test();" />
    </div>   

    for (int i = 0; i < Model.Properties.Count;i++ )
    {
        <span>@Html.CheckBoxFor(m=>Model.Properties[i].IsSelected)
        @Model.Properties[i].LocalName</span>
        @Html.HiddenFor(m=>Model.Properties[i].Id)
        @Html.HiddenFor(m=>Model.Properties[i].Name)
        //string.Format("ArchiveProperty[{0}].Name",i)
        
    }

}
@*<div>
@Html.ActionLink("Save为Excel","Report","Archive",new {activityID=(int)ViewBag.ActivityID, SelectedProperties=Model.SelectedProperties},null)
</div>*@

@using(Html.BeginForm("Report","Archive"))
{
    @Html.Hidden("ActivityID",(int)ViewBag.ActivityID)
    @Html.Hidden("SubjectID",Model.SelectedSubjectID)
    for(int i=0;i<Model.SelectedProperties.Count();i++)
    {
       @Html.HiddenFor(m=>Model.SelectedProperties[i])
    }
    <p>&#8195;</p>
    <input type="submit" value="下载Excel" class="dlExecl" />
}

@using(Html.BeginForm("DownloadArchives","Archive"))
{
    @Html.Hidden("ActivityID",(int)ViewBag.ActivityID)
    @Html.Hidden("SubjectID",Model.SelectedSubjectID)
    <p>&#8195;</p>
    <input type="submit" value="下载档案文件包"  class="dlExecl2" />
}

@{
    var grid = new WebGrid(Model.Archives.ToList(),canPage:false);
}
@grid.GetHtml(columns: (from c in grid.Columns(
     grid.Column("SubjectName", PessResources.Archive.SubjectName),
     grid.Column("CountyName", PessResources.Archive.CountyName),
     grid.Column("CountyCode", PessResources.Archive.CountyCode),
     grid.Column("SchoolComment", PessResources.Archive.SchoolComment, format: (item) => { return Html.Raw(item.SchoolComment);}),
     grid.Column("CountyEBComment", PessResources.Archive.CountyEBComment, format: (item) => { return Html.Raw(item.CountyEBComment);}),
     grid.Column("TeacherName", PessResources.Archive.TeacherName),
     grid.Column("GradeLevel", PessResources.Archive.GradeLevel),
     grid.Column("Gender", PessResources.Archive.Gender),
     grid.Column("PhoneNumber", PessResources.Archive.PhoneNumber),
     grid.Column("EducationDegree", PessResources.Archive.EducationDegree),
     grid.Column("SchoolName", PessResources.Archive.SchoolName),
     grid.Column("SchoolAddress", PessResources.Archive.SchoolAddress),
     grid.Column("SchoolPrincipal", PessResources.Archive.SchoolPrincipal),
     grid.Column("ProjectTitle", PessResources.Archive.ProjectTitle),
     grid.Column("ProjectSN", PessResources.Archive.ProjectSN),
     grid.Column("ReviewFeedback", PessResources.Archive.ReviewFeedback),
     grid.Column("Conclusion", PessResources.Archive.Conclusion),
     grid.Column("PreviousSN", PessResources.Archive.PreviousSN),
     grid.Column("SerialNumber", PessResources.Archive.SerialNumber)
     )
        where Model.SelectedProperties.Contains(c.ColumnName)
        select c)
    )
</fieldset>

<script language="javascript">
    function fly_test() {
        //if (document.getElementsByTagName("tr").length > 2) {
            document.getElementsByTagName("table")[0].className = "oddTable";
        //} else {
            // document.getElementsByTagName("table")[0].className = "none";
        //}
    }
    fly_test();
</script>